home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 April / Software of the Month Club 1996 April.iso / pc / os2 / psutils / src / fixwfwps.pl < prev    next >
Text File  |  1996-02-21  |  793b  |  34 lines

  1. @PERL@
  2. # fixwfwps: fix Word for windows PostScript for printing.
  3. #
  4. # Copyright (C) Angus J. C. Duggan 1991-1995
  5. # See file LICENSE for details.
  6.  
  7. $nesting = 0;
  8. while (<>) {
  9.    tr/\000-\010\012-\014\016-\037//d;
  10.    foreach (grep($_ ne "", split("\015"))) {
  11.       s!/SVDoc\s+save\s+def!!g;
  12.       s!SVDoc\s+restore!!g;
  13.       if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) {
  14.      print "$1\n";
  15.      $wfwepsf = 1;
  16.       } elsif (/^SS\s*$/ && $wfwepsf) {
  17.      print "%%Page: $wfwepsf $wfwepsf\n";
  18.      $wfwepsf++;
  19.      print "$_\n";
  20.       } elsif (/^%MSEPS Preamble/) {
  21.      print "%%BeginDocument: (Included EPSF)\n";
  22.      print "$_\n";
  23.      $nesting++;
  24.       } elsif (/^%MSEPS Trailer/) {
  25.      $nesting--;
  26.      print "$_\n";
  27.      print "%%EndDocument\n";
  28.       } elsif (! /^%%BoundingBox/) {
  29.      print "$_\n";
  30.       }
  31.    }
  32. }
  33. @END@
  34.